<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增终端')" />
</head>
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m" id="form-post-add">
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">所属项目：</label>
                <select class="form-control" name="programId" style="width: 300px;position: relative;margin-left: 205px" id="programSelect" required>
                	
                </select>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">终端名称：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="terminalName" id="terminalName" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">终端公网IP：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="serviceUrl" id="serviceUrl" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label is-required">端口：</label>
				<div class="col-sm-8">
					<input class="form-control" type="text" name="port" id="port" required>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">备注：</label>
				<div class="col-sm-8">
					<textarea id="remark" name="remark" class="form-control"></textarea>
				</div>
			</div>
		</form>
	</div>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "sks/terminal";
		function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/add", $('#form-post-add').serialize());
	        }
	    }
		$(document).ready(function() {
			$.ajax({
			       type: "GET",
			       url: prefix+"/selectProgramList",
			       success: function (data) {
		             //动态拼接 option
		             var option = "";
		             for (var opt = 0; opt < data.data.length; opt++) {
		                  option += "<option value='" + data.data[opt].id + "'  >" + data.data[opt].programName + "</option>";
		              }
		             $("#programSelect").html(option);
			       }
			});
		});
	</script>
</body>
</html>
